cmake_minimum_required(VERSION 3.10)
project(lvgl)
set(CMAKE_C_STANDARD 11)#C11
set(CMAKE_CXX_STANDARD 17)#C17
set(CMAKE_CXX_STANDARD_REQUIRED ON)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
list(APPEND CMAKE_PREFIX_PATH "D:/SDL2-2.30.10/")
set(SDL2_NO_MWINDOWS 1) # 设置为0的话不显示控制台,也就看不到打印信息

find_package(SDL2 REQUIRED SDL2)

file(GLOB_RECURSE INCLUDES 
        "lv_drivers/*.h" 
        "lvgl/demos/*.h"  
        "lvgl/*.h"  
        "./*.h" 
        "user/guider/generated/*.h" 
        "user/guider/generated/images/*.h" 
        "user/guider/generated/guider_fonts/*.h" 
        "user/guider/generated/guider_customer_fonts/*.h"
        "user/guider/custom/*.h" )
file(GLOB_RECURSE SOURCES  
        "lv_drivers/*.c" 
        "lvgl/demos/*.c"  
        "lvgl/src/*.c" 
        "user/guider/generated/*.c" 
        "user/guider/generated/images/*.c" 
        "user/guider/generated/guider_fonts/*.c" 
        "user/guider/generated/guider_customer_fonts/*.c"
        "user/guider/custom/*.c" 
        "user/guider/custom/page/*.c")

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_CXX_FLAGS "-O3")

find_package(SDL2 REQUIRED SDL2)
include_directories(${SDL2_INCLUDE_DIRS} 
    "lvgl/"
    "user/guider/generated/"
    "user/guider/custom/")
add_compile_definitions(LV_CONF_INCLUDE_SIMPLE)
add_executable(main main.c mouse_cursor_icon.c ${SOURCES} ${INCLUDES})
target_link_libraries(main PRIVATE SDL2 )
add_custom_target (run COMMAND ${EXECUTABLE_OUTPUT_PATH}/main)

add_custom_command(
    TARGET main  POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy
    "${SDL2_DIR}/../x86_64-w64-mingw32/bin/SDL2.dll" ${EXECUTABLE_OUTPUT_PATH}
    )
